/**
 * 获取企业组织架构api
 */

import request from '@/utils/request'

// 获取部门信息
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * @description 获取简单员工列表
 * @returns Promise
 */
export function getEmployeeSimple() {
  return request({
    url: '/sys/user/simple',
    method: 'get'
  })
}

/**
 * @description 添加部门
 * @param {*} data
 * @returns
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * @description 通过id获取部门详情
 * @param {*} id
 * @returns
 */
export function getDeptDetails(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

/**
 * @description 编辑部门
 * @param {*} data
 * @returns
 */
export function editDepartment(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * @description 删除部门
 * @param {*} id
 * @returns
 */
export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
